package com.test.cordova.test;

/**
 * 建造者模式
 */

public class Student {

    private String name;
    private int age;

    public Student(StudentBuilder builder) {
        this.name = builder.name;
        this.age = builder.age;
    }


    static class StudentBuilder{
        private String name;
        private int age;

        public StudentBuilder setName(String name) {
            this.name = name;
            return this;
        }

        public StudentBuilder setAge(int age) {
            this.age = age;
            return this;
        }

        public Student build(){
            return new Student(this);
        }
    }

}
